package com.rong.creatmodel.prototype.rk_test;

public class Prototype {
    public static void main(String[] args) {
        Product p1 = new Product(1,100);
        Product clone = p1.clone();
        System.out.println(p1.equals(clone));

    }
}

interface PrototypeMethod{
    Product clone();
}

class Product implements PrototypeMethod{

    private int id;
    private double price;

    public Product() {}

    public Product(int id, double price) {
        this.id = id;
        this.price = price;
    }

    @Override
    public Product clone(){
        Product r = new Product();
        r.id = this.id;
        r.price = this.price;

        return r;
    }

    public int getId() {
        return id;
    }


    public double getPrice() {
        return price;
    }
}
